package com.egao.orderB.controller;

import com.egao.common.core.annotation.ApiPageParam;
import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.*;
import com.egao.common.core.annotation.OperLog;
import com.egao.orderB.entity.ExStorageFee;
import com.egao.orderB.service.ExStorageFeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.ui.Model;


/**
 *
 * 订单运费
 * @author : Doman
 * @date : 2022-03-14 16:04:20
 * @version ：1.0
 */

@Api(tags = "订单运费")
@RestController
@RequestMapping("/api/orderB/exStorageFee")
public class ExStorageFeeController extends BaseController {

	@Autowired
	private ExStorageFeeService exStorageFeeService;

	/**
	 * 分页查询列表
	 */
	@PreAuthorize("hasAuthority('orderB:exStorageFee:list')")
  @ApiOperation(value ="分页查询订单运费",notes = "" +
    "limit:每页显示几行 必填\n" +
    "page:第几页 必填\n" +
    "exStorageId: 出库id 必填\n" +
    " \n\n\n" +
    "返回的结果:\n" +
    "id:id\n" +
    "exStorageId:出库id\n" +
    "type:类型\n" +
    "feeName:费用名称\n" +
    "price:金额\n" +
    "feeState:费用状态:未确认,已确认\n" +
    "feePerson:确认人\n" +
    "feeTime:确认时间\n" +
    "fobject:费用对象 货代,司机,码头\n" +
    "feeModules:模块 运费,提进,其他,单项,采购,报关费,易港通,财务报销\n" +
    "invoiceid:抬头id\n" +
    "invoicename:抬头\n" +
    "driverName:司机名称\n" +
    "invoicenum:税点(这个字段没有用了以后删掉)\n" +
    "invoicestate:是否开票:开票1 不开票0  \n" +
    "currency:币种\n" +
    "exchangeRate:汇率\n" +
    "settlement:销账 0未销账 1部分 2全部\n" +
    "settlementPrice:销账金额\n" +
    "remark:备注\n" +
    "createTime:创建时间\n" +
    "createUser:创建人\n" +
    "updateTime:更新时间\n" +
    "updateUser:更新人\n" +
    "",httpMethod = "POST")
  @ApiPageParam
  @PostMapping("/list")
  public JsonResult page(PageResult2<T> page, ExStorageFee exStorageFee) throws Exception{
    return exStorageFeeService.list(page, exStorageFee, getLoginUser());
  }

  /**
   * 查询全部订单运费
   */
  @PreAuthorize("hasAuthority('orderB:exStorageFee:list')")
  @ApiOperation(value ="查询全部订单运费",notes = "" +
          "exStorageId: 出库id 必填\n" +
          " \n\n\n" +
          "",httpMethod = "POST")
  @PostMapping("/listAll")
  public JsonResult list(ExStorageFee exStorageFee){
    return exStorageFeeService.list(exStorageFee, getLoginUser());
  }

  /**
   * 根据id查询订单运费
   */
  @PreAuthorize("hasAuthority('orderB:exStorageFee:list')")
  @ApiOperation("根据id查询订单运费")
  @PostMapping("/get")
  public JsonResult get(ExStorageFee exStorageFee) {
    return exStorageFeeService.getById(exStorageFee);
  }


  /**
   * 添加订单运费
   */
  @PreAuthorize("hasAuthority('orderB:exStorageFee:save')")
  @OperLog(value = "订单运费", desc = "添加", param = false, result = true)
  @ApiOperation(value ="添加订单运费",notes = "" +
    "exStorageId:出库id\n" +
    "type:应收/应付\n" +
    "feeName:费用名称\n" +
    "price:金额\n" +
//    "feeState:费用状态:未确认,已确认\n" +
//    "feePerson:确认人\n" +
//    "feeTime:确认时间\n" +
//    "fobject:费用对象 货代,司机,码头\n" +
//    "feeModules:模块 运费,提进,其他,单项,采购,报关费,易港通,财务报销\n" +
//    "invoiceid:抬头id\n" +
    "invoicename:抬头\n" +
//    "driverName:司机名称\n" +
//    "invoicenum:税点(这个字段没有用了以后删掉)\n" +
    "invoicestate:是否开票:开票1 不开票0  \n" +
    "currency:币种\n" +
    "exchangeRate:汇率\n" +
//    "settlement:销账 0未销账 1部分 2全部\n" +
//    "settlementPrice:销账金额\n" +
    "remark:备注\n" +
    "",httpMethod = "POST")
  @PostMapping("/save")
  public JsonResult save(Model model, ExStorageFee exStorageFee) {
    return exStorageFeeService.save(exStorageFee, getLoginUser());
  }

  /**
   * 修改订单运费
   */
  @PreAuthorize("hasAuthority('orderB:exStorageFee:update')")
  @OperLog(value = "订单运费", desc = "修改", param = false, result = true)
  @ApiOperation(value ="修改订单运费",notes = "" +
    "id:id\n" +
//          "exStorageId:出库id\n" +
          "type:应收/应付\n" +
          "feeName:费用名称\n" +
          "price:金额\n" +
//    "feeState:费用状态:未确认,已确认\n" +
//    "feePerson:确认人\n" +
//    "feeTime:确认时间\n" +
//    "fobject:费用对象 货代,司机,码头\n" +
//    "feeModules:模块 运费,提进,其他,单项,采购,报关费,易港通,财务报销\n" +
//    "invoiceid:抬头id\n" +
          "invoicename:抬头\n" +
//    "driverName:司机名称\n" +
//    "invoicenum:税点(这个字段没有用了以后删掉)\n" +
          "invoicestate:是否开票:开票1 不开票0  \n" +
          "currency:币种\n" +
          "exchangeRate:汇率\n" +
//    "settlement:销账 0未销账 1部分 2全部\n" +
//    "settlementPrice:销账金额\n" +
          "remark:备注\n" +
    "",httpMethod = "POST")
  @PostMapping("/update")
  public JsonResult update(Model model, ExStorageFee exStorageFee) {
    return exStorageFeeService.update(exStorageFee, getLoginUser());
  }

  /**
   * 删除订单运费
   */
  @PreAuthorize("hasAuthority('orderB:exStorageFee:remove')")
  @OperLog(value = "订单运费", desc = "删除", result = true)
  @ApiOperation(value ="删除订单运费",notes = "" +
    "id:id\n" +
    "",httpMethod = "POST")
  @PostMapping("/remove")
  public JsonResult remove(ExStorageFee exStorageFee ) {
    return exStorageFeeService.remove(exStorageFee, getLoginUser());
  }

}
